package me.magicall.test.db.spring;

import java.util.List;
import java.util.Map;

import javax.sql.DataSource;

import org.springframework.dao.DataAccessException;
import org.springframework.jdbc.core.BatchPreparedStatementSetter;
import org.springframework.jdbc.core.CallableStatementCallback;
import org.springframework.jdbc.core.CallableStatementCreator;
import org.springframework.jdbc.core.ConnectionCallback;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.core.PreparedStatementCallback;
import org.springframework.jdbc.core.PreparedStatementCreator;
import org.springframework.jdbc.core.PreparedStatementSetter;
import org.springframework.jdbc.core.ResultSetExtractor;
import org.springframework.jdbc.core.RowCallbackHandler;
import org.springframework.jdbc.core.RowMapper;
import org.springframework.jdbc.core.SqlParameter;
import org.springframework.jdbc.core.StatementCallback;
import org.springframework.jdbc.support.KeyHolder;
import org.springframework.jdbc.support.SQLExceptionTranslator;
import org.springframework.jdbc.support.nativejdbc.NativeJdbcExtractor;
import org.springframework.jdbc.support.rowset.SqlRowSet;

public class SpringJdbcTemplateImpl {

	private final JdbcTemplate springJdbcTemplate;

	public SpringJdbcTemplateImpl(final DataSource dataSource) {
		super();
		springJdbcTemplate = new org.springframework.jdbc.core.JdbcTemplate(dataSource);
	}

	/*
	 * (non-Javadoc)
	 * @see me.magicall.db.jdbc.JdbcTemplate#afterPropertiesSet()
	 */
	public void afterPropertiesSet() {
		springJdbcTemplate.afterPropertiesSet();
	}

	/*
	 * (non-Javadoc)
	 * @see me.magicall.db.jdbc.JdbcTemplate#batchUpdate(java.lang.String, org.springframework.jdbc.core.BatchPreparedStatementSetter)
	 */
	public int[] batchUpdate(final String sql, final BatchPreparedStatementSetter pss) throws DataAccessException {
		return springJdbcTemplate.batchUpdate(sql, pss);
	}

	/*
	 * (non-Javadoc)
	 * @see me.magicall.db.jdbc.JdbcTemplate#batchUpdate(java.lang.String[])
	 */
	public int[] batchUpdate(final String[] sql) throws DataAccessException {
		return springJdbcTemplate.batchUpdate(sql);
	}

	/*
	 * (non-Javadoc)
	 * /*
	 * (non-Javadoc)
	 * @see me.magicall.db.jdbc.JdbcTemplate#queryForObject(java.lang.String, java.lang.Class)
	 */
	public Object queryForObject(final String sql, final Class<?> requiredType) throws DataAccessException {
		return springJdbcTemplate.queryForObject(sql, requiredType);
	}

	/*
	 * (non-Javadoc)
	 * @see me.magicall.db.jdbc.JdbcTemplate#queryForObject(java.lang.String, java.lang.Object[], java.lang.Class)
	 */
	public Object queryForObject(final String sql, final Object[] args, final Class<?> requiredType) throws DataAccessException {
		return springJdbcTemplate.queryForObject(sql, args, requiredType);
	}

	/*
	 * (non-Javadoc)
	 * @see me.magicall.db.jdbc.JdbcTemplate#queryForObject(java.lang.String, java.lang.Object[], int[], java.lang.Class)
	 */
	public Object queryForObject(final String sql, final Object[] args, final int[] argTypes, final Class<?> requiredType) throws DataAccessException {
		return springJdbcTemplate.queryForObject(sql, args, argTypes, requiredType);
	}

	/*
	 * (non-Javadoc)
	 * @see me.magicall.db.jdbc.JdbcTemplate#queryForRowSet(java.lang.String, java.lang.Object[], int[])
	 */
	public SqlRowSet queryForRowSet(final String sql, final Object[] args, final int[] argTypes) throws DataAccessException {
		return springJdbcTemplate.queryForRowSet(sql, args, argTypes);
	}

	/*
	 * (non-Javadoc)
	 * @see me.magicall.db.jdbc.JdbcTemplate#queryForRowSet(java.lang.String, java.lang.Object[])
	 */
	public SqlRowSet queryForRowSet(final String sql, final Object[] args) throws DataAccessException {
		return springJdbcTemplate.queryForRowSet(sql, args);
	}

	/*
	 * (non-Javadoc)
	 * @see me.magicall.db.jdbc.JdbcTemplate#queryForRowSet(java.lang.String)
	 */
	public SqlRowSet queryForRowSet(final String sql) throws DataAccessException {
		return springJdbcTemplate.queryForRowSet(sql);
	}

	/*
	 * (non-Javadoc)
	 * @see me.magicall.db.jdbc.JdbcTemplate#setDatabaseProductName(java.lang.String)
	 */
	public void setDatabaseProductName(final String dbName) {
		springJdbcTemplate.setDatabaseProductName(dbName);
	}

	/*
	 * (non-Javadoc)
	 * @see me.magicall.db.jdbc.JdbcTemplate#setDataSource(javax.sql.DataSource)
	 */
	public void setDataSource(final DataSource dataSource) {
		springJdbcTemplate.setDataSource(dataSource);
	}

	/*
	 * (non-Javadoc)
	 * @see me.magicall.db.jdbc.JdbcTemplate#setExceptionTranslator(org.springframework.jdbc.support.SQLExceptionTranslator)
	 */
	public void setExceptionTranslator(final SQLExceptionTranslator exceptionTranslator) {
		springJdbcTemplate.setExceptionTranslator(exceptionTranslator);
	}

	/*
	 * (non-Javadoc)
	 * @see me.magicall.db.jdbc.JdbcTemplate#setFetchSize(int)
	 */
	public void setFetchSize(final int fetchSize) {
		springJdbcTemplate.setFetchSize(fetchSize);
	}

	/*
	 * (non-Javadoc)
	 * @see me.magicall.db.jdbc.JdbcTemplate#setIgnoreWarnings(boolean)
	 */
	public void setIgnoreWarnings(final boolean ignoreWarnings) {
		springJdbcTemplate.setIgnoreWarnings(ignoreWarnings);
	}

	/*
	 * (non-Javadoc)
	 * @see me.magicall.db.jdbc.JdbcTemplate#setLazyInit(boolean)
	 */
	public void setLazyInit(final boolean lazyInit) {
		springJdbcTemplate.setLazyInit(lazyInit);
	}

	/*
	 * (non-Javadoc)
	 * @see me.magicall.db.jdbc.JdbcTemplate#setMaxRows(int)
	 */
	public void setMaxRows(final int maxRows) {
		springJdbcTemplate.setMaxRows(maxRows);
	}

	/*
	 * (non-Javadoc)
	 * @see me.magicall.db.jdbc.JdbcTemplate#setNativeJdbcExtractor(org.springframework.jdbc.support.nativejdbc.NativeJdbcExtractor)
	 */
	public void setNativeJdbcExtractor(final NativeJdbcExtractor extractor) {
		springJdbcTemplate.setNativeJdbcExtractor(extractor);
	}

	/*
	 * (non-Javadoc)
	 * @see me.magicall.db.jdbc.JdbcTemplate#setQueryTimeout(int)
	 */
	public void setQueryTimeout(final int queryTimeout) {
		springJdbcTemplate.setQueryTimeout(queryTimeout);
	}

	/*
	 * (non-Javadoc)
	 * @see me.magicall.db.jdbc.JdbcTemplate#setResultsMapCaseInsensitive(boolean)
	 */
	public void setResultsMapCaseInsensitive(final boolean resultsMapCaseInsensitive) {
		springJdbcTemplate.setResultsMapCaseInsensitive(resultsMapCaseInsensitive);
	}

	/*
	 * (non-Javadoc)
	 * @see me.magicall.db.jdbc.JdbcTemplate#setSkipResultsProcessing(boolean)
	 */
	public void setSkipResultsProcessing(final boolean skipResultsProcessing) {
		springJdbcTemplate.setSkipResultsProcessing(skipResultsProcessing);
	}

	/*
	 * (non-Javadoc)
	 * @see me.magicall.db.jdbc.JdbcTemplate#setSkipUndeclaredResults(boolean)
	 */
	public void setSkipUndeclaredResults(final boolean skipUndeclaredResults) {
		springJdbcTemplate.setSkipUndeclaredResults(skipUndeclaredResults);
	}

	/*
	 * (non-Javadoc)
	 * @see me.magicall.db.jdbc.JdbcTemplate#update(org.springframework.jdbc.core.PreparedStatementCreator, org.springframework.jdbc.support.KeyHolder)
	 */
	public int update(final PreparedStatementCreator psc, final KeyHolder generatedKeyHolder) throws DataAccessException {
		return springJdbcTemplate.update(psc, generatedKeyHolder);
	}

	/*
	 * (non-Javadoc)
	 * @see me.magicall.db.jdbc.JdbcTemplate#update(org.springframework.jdbc.core.PreparedStatementCreator)
	 */
	public int update(final PreparedStatementCreator psc) throws DataAccessException {
		return springJdbcTemplate.update(psc);
	}

	/*
	 * (non-Javadoc)
	 * @see me.magicall.db.jdbc.JdbcTemplate#update(java.lang.String, java.lang.Object[], int[])
	 */
	public int update(final String sql, final Object[] args, final int[] argTypes) throws DataAccessException {
		return springJdbcTemplate.update(sql, args, argTypes);
	}

	/*
	 * (non-Javadoc)
	 * @see me.magicall.db.jdbc.JdbcTemplate#update(java.lang.String, java.lang.Object[])
	 */
	public int update(final String sql, final Object[] args) throws DataAccessException {
		return springJdbcTemplate.update(sql, args);
	}

	/*
	 * (non-Javadoc)
	 * @see me.magicall.db.jdbc.JdbcTemplate#update(java.lang.String, org.springframework.jdbc.core.PreparedStatementSetter)
	 */
	public int update(final String sql, final PreparedStatementSetter pss) throws DataAccessException {
		return springJdbcTemplate.update(sql, pss);
	}

	/*
	 * (non-Javadoc)
	 * @see me.magicall.db.jdbc.JdbcTemplate#update(java.lang.String)
	 */
	public int update(final String sql) throws DataAccessException {
		return springJdbcTemplate.update(sql);
	}

	public Map<String, Object> call(final CallableStatementCreator csc, final List<SqlParameter> declaredParameters) throws DataAccessException {
		return springJdbcTemplate.call(csc, declaredParameters);
	}

	public <T> T execute(final CallableStatementCreator csc, final CallableStatementCallback<T> action) throws DataAccessException {
		return springJdbcTemplate.execute(csc, action);
	}

	public <T> T execute(final ConnectionCallback<T> action) throws DataAccessException {
		return springJdbcTemplate.execute(action);
	}

	public <T> T execute(final PreparedStatementCreator psc, final PreparedStatementCallback<T> action) throws DataAccessException {
		return springJdbcTemplate.execute(psc, action);
	}

	public <T> T execute(final StatementCallback<T> action) throws DataAccessException {
		return springJdbcTemplate.execute(action);
	}

	public <T> T execute(final String callString, final CallableStatementCallback<T> action) throws DataAccessException {
		return springJdbcTemplate.execute(callString, action);
	}

	public <T> T execute(final String sql, final PreparedStatementCallback<T> action) throws DataAccessException {
		return springJdbcTemplate.execute(sql, action);
	}

	public void execute(final String sql) throws DataAccessException {
		springJdbcTemplate.execute(sql);
	}

	public DataSource getDataSource() {
		return springJdbcTemplate.getDataSource();
	}

	public SQLExceptionTranslator getExceptionTranslator() {
		return springJdbcTemplate.getExceptionTranslator();
	}

	public int getFetchSize() {
		return springJdbcTemplate.getFetchSize();
	}

	public int getMaxRows() {
		return springJdbcTemplate.getMaxRows();
	}

	public NativeJdbcExtractor getNativeJdbcExtractor() {
		return springJdbcTemplate.getNativeJdbcExtractor();
	}

	public int getQueryTimeout() {
		return springJdbcTemplate.getQueryTimeout();
	}

	public boolean isIgnoreWarnings() {
		return springJdbcTemplate.isIgnoreWarnings();
	}

	public boolean isLazyInit() {
		return springJdbcTemplate.isLazyInit();
	}

	public boolean isResultsMapCaseInsensitive() {
		return springJdbcTemplate.isResultsMapCaseInsensitive();
	}

	public boolean isSkipResultsProcessing() {
		return springJdbcTemplate.isSkipResultsProcessing();
	}

	public boolean isSkipUndeclaredResults() {
		return springJdbcTemplate.isSkipUndeclaredResults();
	}

	public <T> T query(final PreparedStatementCreator psc, final PreparedStatementSetter pss, final ResultSetExtractor<T> rse) throws DataAccessException {
		return springJdbcTemplate.query(psc, pss, rse);
	}

	public <T> T query(final PreparedStatementCreator psc, final ResultSetExtractor<T> rse) throws DataAccessException {
		return springJdbcTemplate.query(psc, rse);
	}

	public void query(final PreparedStatementCreator psc, final RowCallbackHandler rch) throws DataAccessException {
		springJdbcTemplate.query(psc, rch);
	}

	public <T> List<T> query(final PreparedStatementCreator psc, final RowMapper<T> rowMapper) throws DataAccessException {
		return springJdbcTemplate.query(psc, rowMapper);
	}

	public <T> T query(final String sql, final Object[] args, final int[] argTypes, final ResultSetExtractor<T> rse) throws DataAccessException {
		return springJdbcTemplate.query(sql, args, argTypes, rse);
	}

	public void query(final String sql, final Object[] args, final int[] argTypes, final RowCallbackHandler rch) throws DataAccessException {
		springJdbcTemplate.query(sql, args, argTypes, rch);
	}

	public <T> List<T> query(final String sql, final Object[] args, final int[] argTypes, final RowMapper<T> rowMapper) throws DataAccessException {
		return springJdbcTemplate.query(sql, args, argTypes, rowMapper);
	}

	public <T> T query(final String sql, final Object[] args, final ResultSetExtractor<T> rse) throws DataAccessException {
		return springJdbcTemplate.query(sql, args, rse);
	}

	public void query(final String sql, final Object[] args, final RowCallbackHandler rch) throws DataAccessException {
		springJdbcTemplate.query(sql, args, rch);
	}

	public <T> List<T> query(final String sql, final Object[] args, final RowMapper<T> rowMapper) throws DataAccessException {
		return springJdbcTemplate.query(sql, args, rowMapper);
	}

	public <T> T query(final String sql, final PreparedStatementSetter pss, final ResultSetExtractor<T> rse) throws DataAccessException {
		return springJdbcTemplate.query(sql, pss, rse);
	}

	public void query(final String sql, final PreparedStatementSetter pss, final RowCallbackHandler rch) throws DataAccessException {
		springJdbcTemplate.query(sql, pss, rch);
	}

	public <T> List<T> query(final String sql, final PreparedStatementSetter pss, final RowMapper<T> rowMapper) throws DataAccessException {
		return springJdbcTemplate.query(sql, pss, rowMapper);
	}

	public <T> T query(final String sql, final ResultSetExtractor<T> rse, final Object... args) throws DataAccessException {
		return springJdbcTemplate.query(sql, rse, args);
	}

	public <T> T query(final String sql, final ResultSetExtractor<T> rse) throws DataAccessException {
		return springJdbcTemplate.query(sql, rse);
	}

	public void query(final String sql, final RowCallbackHandler rch, final Object... args) throws DataAccessException {
		springJdbcTemplate.query(sql, rch, args);
	}

	public void query(final String sql, final RowCallbackHandler rch) throws DataAccessException {
		springJdbcTemplate.query(sql, rch);
	}

	public <T> List<T> query(final String sql, final RowMapper<T> rowMapper, final Object... args) throws DataAccessException {
		return springJdbcTemplate.query(sql, rowMapper, args);
	}

	public <T> List<T> query(final String sql, final RowMapper<T> rowMapper) throws DataAccessException {
		return springJdbcTemplate.query(sql, rowMapper);
	}

	public int queryForInt(final String sql, final Object... args) throws DataAccessException {
		return springJdbcTemplate.queryForInt(sql, args);
	}

	public int queryForInt(final String sql, final Object[] args, final int[] argTypes) throws DataAccessException {
		return springJdbcTemplate.queryForInt(sql, args, argTypes);
	}

	public int queryForInt(final String sql) throws DataAccessException {
		return springJdbcTemplate.queryForInt(sql);
	}

	public <T> List<T> queryForList(final String sql, final Class<T> elementType, final Object... args) throws DataAccessException {
		return springJdbcTemplate.queryForList(sql, elementType, args);
	}

	public <T> List<T> queryForList(final String sql, final Class<T> elementType) throws DataAccessException {
		return springJdbcTemplate.queryForList(sql, elementType);
	}

	public List<Map<String, Object>> queryForList(final String sql, final Object... args) throws DataAccessException {
		return springJdbcTemplate.queryForList(sql, args);
	}

	public <T> List<T> queryForList(final String sql, final Object[] args, final Class<T> elementType) throws DataAccessException {
		return springJdbcTemplate.queryForList(sql, args, elementType);
	}

	public <T> List<T> queryForList(final String sql, final Object[] args, final int[] argTypes, final Class<T> elementType) throws DataAccessException {
		return springJdbcTemplate.queryForList(sql, args, argTypes, elementType);
	}

	public List<Map<String, Object>> queryForList(final String sql, final Object[] args, final int[] argTypes) throws DataAccessException {
		return springJdbcTemplate.queryForList(sql, args, argTypes);
	}

	public List<Map<String, Object>> queryForList(final String sql) throws DataAccessException {
		return springJdbcTemplate.queryForList(sql);
	}

	public long queryForLong(final String sql, final Object... args) throws DataAccessException {
		return springJdbcTemplate.queryForLong(sql, args);
	}

	public long queryForLong(final String sql, final Object[] args, final int[] argTypes) throws DataAccessException {
		return springJdbcTemplate.queryForLong(sql, args, argTypes);
	}

	public long queryForLong(final String sql) throws DataAccessException {
		return springJdbcTemplate.queryForLong(sql);
	}

	public Map<String, Object> queryForMap(final String sql, final Object... args) throws DataAccessException {
		return springJdbcTemplate.queryForMap(sql, args);
	}

	public Map<String, Object> queryForMap(final String sql, final Object[] args, final int[] argTypes) throws DataAccessException {
		return springJdbcTemplate.queryForMap(sql, args, argTypes);
	}

	public Map<String, Object> queryForMap(final String sql) throws DataAccessException {
		return springJdbcTemplate.queryForMap(sql);
	}

	public <T> T queryForObject(final String sql, final Class<T> requiredType, final Object... args) throws DataAccessException {
		return springJdbcTemplate.queryForObject(sql, requiredType, args);
	}

	public <T> T queryForObject(final String sql, final RowMapper<T> rowMapper, final Object... args) throws DataAccessException {
		return springJdbcTemplate.queryForObject(sql, rowMapper, args);
	}

	public <T> T queryForObject(final String sql, final Object[] args, final int[] argTypes, final RowMapper<T> rowMapper) throws DataAccessException {
		return springJdbcTemplate.queryForObject(sql, args, argTypes, rowMapper);
	}

	public <T> T queryForObject(final String sql, final Object[] args, final RowMapper<T> rowMapper) throws DataAccessException {
		return springJdbcTemplate.queryForObject(sql, args, rowMapper);
	}

	public <T> T queryForObject(final String sql, final RowMapper<T> rowMapper) throws DataAccessException {
		return springJdbcTemplate.queryForObject(sql, rowMapper);
	}

}
